package com.lmiot.xyclick.Activity;

import android.app.Dialog;
import android.os.Bundle;
import android.support.v7.widget.SwitchCompat;
import android.view.View;
import android.widget.RelativeLayout;
import com.lkx.liandianqinew.R;
import com.yhao.floatwindow.FloatUtil;
import com.youyi.yyviewsdklibrary.View.TitleBarView;

public class RemoteSettingActivity extends BaseActivity implements View.OnClickListener {
    private static final String TAG = "AutoSettingActivity";
    private Dialog mDialog;
    RelativeLayout mIdDoautoLayout;
    SwitchCompat mIdDoautoSwitch;
    RelativeLayout mIdLocalLayout;
    SwitchCompat mIdLocalSwitch;
    RelativeLayout mIdRemoteLayout;
    SwitchCompat mIdRemoteSwitch;
    TitleBarView mIdTitleBar;

    /* access modifiers changed from: protected */
    @Override // android.support.v4.app.SupportActivity, com.lmiot.xyclick.Activity.BaseActivity, android.support.v7.app.AppCompatActivity, android.support.v4.app.FragmentActivity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_remote_setting);
        initView();
        init();
    }

    private void init() {
        this.mIdTitleBar.setOnItemClickListener(new TitleBarView.onItemClickListener() {
            /* class com.lmiot.xyclick.Activity.RemoteSettingActivity.AnonymousClass1 */

            @Override // com.youyi.yyviewsdklibrary.View.TitleBarView.onItemClickListener
            public void onMenuClick(View view) {
            }

            @Override // com.youyi.yyviewsdklibrary.View.TitleBarView.onItemClickListener
            public void onTitleClick(View view) {
            }

            @Override // com.youyi.yyviewsdklibrary.View.TitleBarView.onItemClickListener
            public void onBackClick(View view) {
                RemoteSettingActivity.this.finish();
            }
        });
    }

    @Override // com.lmiot.xyclick.Activity.BaseActivity, android.support.v4.app.FragmentActivity
    public void onResume() {
        super.onResume();
        showAllData();
    }

    private void showAllData() {
        this.mIdRemoteSwitch.setChecked(FloatUtil.getRemote(this));
        this.mIdDoautoSwitch.setChecked(FloatUtil.getRemoteDoAuto(this));
        this.mIdLocalSwitch.setChecked(FloatUtil.getRemoteDoLocal(this));
    }

    private void initView() {
        this.mIdTitleBar = (TitleBarView) findViewById(R.id.id_title_bar);
        this.mIdRemoteSwitch = (SwitchCompat) findViewById(R.id.id_remote_switch);
        this.mIdRemoteLayout = (RelativeLayout) findViewById(R.id.id_remote_layout);
        this.mIdDoautoSwitch = (SwitchCompat) findViewById(R.id.id_doauto_switch);
        this.mIdDoautoLayout = (RelativeLayout) findViewById(R.id.id_doauto_layout);
        this.mIdLocalSwitch = (SwitchCompat) findViewById(R.id.id_local_switch);
        this.mIdLocalLayout = (RelativeLayout) findViewById(R.id.id_local_layout);
        this.mIdRemoteSwitch.setOnClickListener(this);
        this.mIdRemoteLayout.setOnClickListener(this);
        this.mIdDoautoSwitch.setOnClickListener(this);
        this.mIdDoautoLayout.setOnClickListener(this);
        this.mIdLocalSwitch.setOnClickListener(this);
        this.mIdLocalLayout.setOnClickListener(this);
    }

    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.id_doauto_layout /*{ENCODED_INT: 2131296592}*/:
                if (this.mIdDoautoSwitch.isChecked()) {
                    this.mIdDoautoSwitch.setChecked(false);
                    FloatUtil.setRemoteDoAuto(this, false);
                    return;
                }
                this.mIdDoautoSwitch.setChecked(true);
                FloatUtil.setRemoteDoAuto(this, true);
                return;
            case R.id.id_doauto_switch /*{ENCODED_INT: 2131296593}*/:
                if (this.mIdDoautoSwitch.isChecked()) {
                    FloatUtil.setRemoteDoAuto(this, true);
                    return;
                } else {
                    FloatUtil.setRemoteDoAuto(this, false);
                    return;
                }
            case R.id.id_local_layout /*{ENCODED_INT: 2131296744}*/:
                if (this.mIdLocalSwitch.isChecked()) {
                    this.mIdLocalSwitch.setChecked(false);
                    FloatUtil.setRemoteDoLocal(this, false);
                    return;
                }
                this.mIdLocalSwitch.setChecked(true);
                FloatUtil.setRemoteDoLocal(this, true);
                return;
            case R.id.id_local_switch /*{ENCODED_INT: 2131296745}*/:
                if (this.mIdLocalSwitch.isChecked()) {
                    FloatUtil.setRemoteDoLocal(this, true);
                    return;
                } else {
                    FloatUtil.setRemoteDoLocal(this, false);
                    return;
                }
            case R.id.id_remote_layout /*{ENCODED_INT: 2131296879}*/:
                if (this.mIdRemoteSwitch.isChecked()) {
                    this.mIdRemoteSwitch.setChecked(false);
                    FloatUtil.setRemote(this, false);
                    return;
                }
                this.mIdRemoteSwitch.setChecked(true);
                FloatUtil.setRemote(this, true);
                return;
            case R.id.id_remote_switch /*{ENCODED_INT: 2131296880}*/:
                if (this.mIdRemoteSwitch.isChecked()) {
                    FloatUtil.setRemote(this, true);
                    return;
                } else {
                    FloatUtil.setRemote(this, false);
                    return;
                }
            default:
                return;
        }
    }
}
